< previous page page_449 next page >

Page 449
The X and Y coordinates of the projection of the vector are n1 and n2, so the length of the projection is D = Sqr(n1 * n1 + n2 * n2). Then Sin(q) = n1/D and Cos(q) = n2/D. This makes the first rotation's transformation matrix:
e10a6a0a59f035e870d90cca05b85fce.gif
 z0469-01.gif
Figure 13.29 shows the plane translated and rotated so that the normal vector lies in the Y-Z plane.
Now you must rotate by angle f around the X axis to make the normal vector lie along the Y axis. The angle of rotation is f, not f, because you must measure angles in the counterclockwise direction as you look down the axis toward the origin. The angle f is measured in the clockwise direction, so you must rotate by the angle f. The transformation matrix for this rotation is:
e10a6a0a59f035e870d90cca05b85fce.gif
 z0469-02.gif
The Y coordinate of the tip of the translated and rotated vector is now D = Sqr(nl * nl + n2 * n2). The total length of the vector is L = Sqr(nl * nl + n2 * n2 + n3 * n3). This means Sin(f) = Sin(f) = n3/L and Cos(f) = Cos(f) = D/L. With these values, the second rotation matrix becomes:
e10a6a0a59f035e870d90cca05b85fce.gif
 z0469-03.gif
Figure 13.30 shows the plane of reflection and its normal vector after you have applied the translation and two rotations. At this point, reflecting objects across the X-Z plane is easy. Simply use a scaling transformation where the X and Z coordinates are unchanged and the Y coordinate is scaled by a factor of 1. The matrix for this operation is:
z0469-04.gif
Figure 13.29
The normal vector in the Y-Z plane.

 
< previous page page_449 next page >